package yunjiao.designpatterns.visitor.example2.items;

import lombok.Data;
import yunjiao.designpatterns.visitor.example2.ShopVisitor;

/**
 * TODO
 *
 * @author yangyunjiao
 */
@Data
public class Fruit implements ShopItem {

    private String name;
    private double pricePerKg;
    private double weight;

    public Fruit(String name, double pricePerKg, double weight) {
        this.name = name;
        this.pricePerKg = pricePerKg;
        this.weight = weight;
    }

    @Override
    public double getPrice() {
        return getPricePerKg();
    }


    @Override
    public ShopItemCategory getCategory() {
        return ShopItemCategory.FRUIT;
    }

    @Override
    public double accept(ShopVisitor visitor) {
        return visitor.visit(this);
    }

    @Override
    public String toString() {
        return "Fruit [name=" + name +
                ", pricePerKg=" + pricePerKg +
                ", weight=" + weight +
                "]";
    }

}
